<template>
  <div>
    <Dog2 
    v-for="(obj,index) in arr" :key= "index"
    :url="obj.dogImgUrl"
    :uname="obj.dogName"
    @LiveDog="liveFn"
    />
    <hr>
    <h3>显示喜欢的狗:</h3>
    <ul>
      <li v-for="item in newArr" :key="item"><h3>{{item}}</h3></li>
    </ul>
  </div>
</template>

<script>
import Dog2 from "./components/Dog3.vue"
export default {
data(){
  return{
    arr:[
    {
        dogImgUrl:
        "https://tse4-mm.cn.bing.net/th/id/OIP-C.4NC6zYQAxfMwl9Xtje1YzgAAAA?w=169&h=180&c=7&r=0&o=5&dpr=1.25&pid=1.7",
        dogName: "博美",
    },
    {
        dogImgUrl:
        "https://tse2-mm.cn.bing.net/th/id/OIP-C.jhtQzwO3POa_5Kfv8kAYLgAAAA?w=244&h=173&c=7&r=0&o=5&dpr=1.25&pid=1.7",
        dogName: "泰迪",
    },
    {
        dogImgUrl:
        "https://tse4-mm.cn.bing.net/th/id/OIP-C.TxXIgEzl8PmGNy2jPDysuwHaHH?w=184&h=180&c=7&r=0&o=5&dpr=1.25&pid=1.7",
        dogName: "金毛",
    },
    {
        dogImgUrl:
        "https://tse3-mm.cn.bing.net/th/id/OIP-C.s1_WaQ_K-fcMg1I1eSuGmQHaE7?w=273&h=183&c=7&r=0&o=5&dpr=1.25&pid=1.7",
        dogName: "哈士奇",
    },
    {
        dogImgUrl:
        "https://tse4-mm.cn.bing.net/th/id/OIP-C.XnbYelV0e-ad4IOfpflPdgHaGy?w=185&h=192&c=7&r=0&o=5&dpr=1.25&pid=1.7",
        dogName: "阿拉斯加",
    },
    {
        dogImgUrl:
        "https://tse2-mm.cn.bing.net/th/id/OIP-C.-eCjYeX2Rr3sLqrt-n-0awHaIg?w=171&h=196&c=7&r=0&o=5&dpr=1.25&pid=1.7",
        dogName: "萨摩耶",
    },
],
newArr:[]
  }
},
components:{
  Dog2
},
methods:{
  liveFn(dogName){
    this.newArr.push(dogName)
  }
}
}
</script>

<style>

</style>